<% layout('/layouts/default.html', {title: '车辆详情管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa icon-notebook"></i> ${text('车辆详情管理')}
			</div>
			<div class="box-tools pull-right">
				<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
				<% if(hasPermi('car:car:edit')){ %>
					<a href="${ctx}/car/car/form" class="btn btn-default btnTool" title="${text('新增车辆详情')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
				<% } %>
				<a href="#" class="btn btn-default" id="btnSetting" title="${text('设置')}"><i class="fa fa-navicon"></i></a>
			</div>
		</div>
		<div class="box-body">
			<#form:form id="searchForm" model="${car}" action="${ctx}/car/car/listData" method="post" class="form-inline"
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
				<div class="form-group">
					<label class="control-label">${text('车型')}：</label>
					<div class="control-inline width-120">
						<#form:select path="bigType" dictType="h_big_type" blankOptionLabel="全部" blankOption="true" class="form-control isQuick"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('类型')}：</label>
					<div class="control-inline width-160" >
						<#form:treeselect id="typeId" title="${text('类型选择')}"
							path="typeId" labelPath="treeName" canSelectParent="true" canSelectRoot="true"
							url="${ctx}/car/carType/treeData" allowClear="true" class="isQuick"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('名称')}：</label>
					<div class="control-inline">
						<#form:input path="carTitle" maxlength="64" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('状态')}：</label>
					<div class="control-inline width-120">
						<#form:select path="carStatus" dictType="h_car_status" blankOptionLabel="全部" blankOption="true" class="form-control isQuick"/>
					</div>
				</div>
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm"><i class="glyphicon glyphicon-search"></i> ${text('查询')}</button>
					<button type="reset" class="btn btn-default btn-sm isQuick"><i class="glyphicon glyphicon-repeat"></i> ${text('重置')}</button>
				</div>
			</#form:form>
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
//# // 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	emptyDataHint: true,
	columnModel: [
		{header:'${text("名称")}', name:'carTitle', index:'a.car_title', width:150, align:"center"},
		{header:'${text("类型")}', name:'treeName', width:150, align:"center"},
		{header:'${text("品牌")}', name:'brand', index:'a.brand', width:150, align:"center"},
		{header:'${text("公里")}', name:'kilometer', index:'a.kilometer', width:150, align:"center", formatter: function(val, obj, row, act){
				return val+' 余公里';
			}},
		{header:'${text("售价")}', name:'sellPrice', index:'a.sell_price', width:150, align:"center", formatter: function(val, obj, row, act){
				return '<span class="text-red">'+js.formatMoney(val/100, 2)+' 元</span>';
			}},
		{header:'${text("过户")}', name:'transfers', index:'a.transfers', width:100, align:"center", formatter: function(val, obj, row, act){
			return val+' 次';
			}},
		{header:'${text("上户日期")}', name:'registerDate', index:'a.register_date', width:120, align:"center"},
		{header:'${text("状态")}', name:'carStatus', index:'a.car_status', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel("#{@DictUtils.getDictListJson('h_car_status')}", val, '${text("未知")}', true);
		}},
		{header:'${text("创建时间")}', name:'updateDate', index:'a.update_date', width:150, align:"center"},
		{header:'${text("备注")}', name:'remarks', index:'a.remarks', width:100, align:"center"},
		{header:'${text("操作")}', name:'actions', width:120, formatter: function(val, obj, row, act){
			var actions = [];
			//# if(hasPermi('car:car:edit')){
				actions.push('<a href="${ctx}/car/car/formEdit?carId='+row.carId+'" class="btnList" title="${text("编辑车辆详情")}"><i class="fa fa-pencil"></i></a>&nbsp;');
				actions.push('<a href="${ctx}/car/car/FormImg?carId='+row.carId+'" class="btnList" title="${text("编辑车辆图片")}"><i class="fa fa-file-picture-o (alias)"></i></a>&nbsp;');
				if (row.carStatus == '0'){
					actions.push('<a href="${ctx}/car/car/updateStatus?carId='+row.carId+'&carStatus=2" class="btnList" title="${text("下架车辆")}" data-confirm="${text("确认要下架该车辆吗？")}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
				} else if (row.carStatus == '2'){
					actions.push('<a href="${ctx}/car/car/updateStatus?carId='+row.carId+'&carStatus=0" class="btnList" title="${text("上架车辆")}" data-confirm="${text("确认要上架该车辆吗？")}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
				}
				actions.push('<a href="${ctx}/car/car/updateStatus?carId='+row.carId+'&carStatus=1" class="btnList" title="${text("删除车辆")}" data-confirm="${text("确认要删除该车辆吗？")}"><i class="fa fa-trash-o"></i></a>&nbsp;');
			//# }
                if (row.carStatus=="3"){
                    actions.push('<a href="${ctx}/examine/examine/examineInfo?carId='+row.carId+'&isEdit=t" class="btnList" title="${text("审核车辆")}"><i class="fa icon-loop text-orange"></i></a>&nbsp;');
                }
			return actions.join('');
		}}
	],
	//# // 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});
</script>